<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Promise的使用</title>
</head>
<body>
<script>
  new Promise((resolve, reject) => {
    setTimeout(() => {
      console.log('这是一个网络请求返回结果');
      // resolve('请求返回成功');
      reject('请求失败');
    }, 1000)
  }).then((res) => {
    console.log(res);
  }).catch((err)=>{
    console.log(err);
  })

</script>
</body>
</html>
